
//window.URL = window.URL || window.webkitURL;

//var fileElem = document.getElementById("fileElem"),
//
//	Img= document.getElementById("Img");
//
//var files;
//function handleFiles(obj) {
//	files = obj.files,
//	img = new Image();
//
//	if(window.URL){
//		img.src = window.URL.createObjectURL(files[0]);
//		console.log(window.URL)
//		console.log(files[0])
//		img.onload = function(e) {
//			Img.src=this.src;
//			
//		}
//	}
//}

	var iss = document.getElementById("iss")
	
   	iss.onclick = function (){
		if(document.getElementById("Img").src == "../../images/photo-load.png"){
			alert("图片不能为空")
		}else{
			var fName = document.getElementsByClassName("proDes")[0].value
			
			var headUrl;
			
			if (window.XMLHttpRequest)
			{
			    //  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
			    xhr=new XMLHttpRequest();
			}
			else
			{
			    // IE6, IE5 浏览器执行代码
			    xhr=new ActiveXObject("Microsoft.XMLHTTP");
			}
			var url = "api/v1/upload/"
//			var xhr = new XMLHttpRequest()			
			var fd = new FormData()
			
			xhr.open("post",url,true);
			xhr.onreadystatechange=function()
			{
			    if (xhr.readyState==4 && xhr.status==200)
			    {
		        document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
					alert('请求成功');
					headUrl = xhr.responseText;
			    }else{
			    	alert('请求失败');
			    }
			}
			
			fd.append("file",file)
			xhr.send(fd);
		}
}


